<?php

namespace Database\Factories;

use App\Models\Event;
use App\Models\Order;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Order>
 */
class OrderFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $event = Event::factory()->create();
        $quantity = $this->faker->numberBetween(1, 5);
        $totalAmount = $event->price * $quantity;
        
        return [
            'user_id' => User::factory(),
            'event_id' => $event->id,
            'quantity' => $quantity,
            'total_amount' => $totalAmount,
            'status' => $this->faker->randomElement(['pending', 'paid', 'cancelled']),
        ];
    }
}